package com.archetypus.projectschedule.web.people.cmd;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.archetypus.projectschedule.common.dto.people.Person;
import com.archetypus.projectschedule.common.dto.people.PersonKey;
import com.archetypus.projectschedule.common.exceptions.ProjectSchedulerException;
import com.archetypus.projectschedule.web.common.cmd.ICommand;
import com.archetypus.projectschedule.web.people.bd.IPersonBD;
import com.archetypus.projectschedule.web.people.bd.PersonBD;

public class UpdatePersonCmd implements ICommand {

	public void execute(HttpServletRequest request,HttpServletResponse response) throws ProjectSchedulerException {
		int personId = Integer.parseInt(request.getParameter("id"));
		String name = request.getParameter("name");
		String email = request.getParameter("email");
		
		Person person = new Person();
		person.setPersonKey(new PersonKey(personId));
		person.setName(name);
		person.setEmail(email);
		
		IPersonBD personBD = new PersonBD();
		personBD.updatePerson(person);	
	}

}
